package day04test;
import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        //1. 接收用户命令
        System.out.println("请输入命令：");
        Scanner scan=new Scanner(System.in);
        int command=scan.nextInt();
        System.out.println("命令是："+command);
        //2. Guessing   ...while
        //随机数1~1000
        int num=(int) (Math.random()*1000+1);
        System.out.println("guess1数");
        int guess1=scan.nextInt();
        while (guess1!=num){
            if (guess1>num){
                System.out.println("猜大了");
            }else {
                System.out.println("猜小了");
            }
            System.out.println("请重新输入");
            guess1=scan.nextInt();
        }
        System.out.println("猜对了1");
        //do____while
        int guess2;
        do {
            System.out.println("guess2数");
            guess2=scan.nextInt();
            if (guess2>num){
                System.out.println("猜大了");
            } else if (guess2<num) {
                System.out.println("猜小了");
            }else {
                System.out.println("猜对了2");
            }
        }while (guess2!=num);
        //for
        for (int i=1;i<=5;i++){
            System.out.println("元神启动");
        }
        for (int i=1;i<=9;i++){
            System.out.println(i+"*9="+i*9);
        }
        for (int i=9;i>=1;i--){
            System.out.println(i+"*9="+i*9);
        }
        for (int i=1;i<=9;i+=2){
            System.out.println(i+"*9="+i*9);
        }
        int sum=0;
        for (int i=1;i<=100;i++){
            sum+=i;
        }
        System.out.println("1~100的和是："+sum);
    }
}
